class User{
    private String num = "123456";
    private String name = "zzy";

    public User(String num, String name) throws UserException{
        if(!this.num.equals(num)){
            throw new UserException("密码错误，登录失败...");
        }
        else {
            System.out.println("密码正确！");
        }
    }
}


class UserException extends Exception{
    public UserException(String message) {
        super(message);
    }
}
public class Text {
    public static void main(String[] args) {
        try {
            User user = new User("123456","zzy");
        }catch (UserException e) {
            e.printStackTrace();
        }
        finally {
            System.out.println("处理异常完成...");
        }
    }
}


